package top.yxqz.session.demo.web;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author Mr.余
 * @date 2022/11/27
 * @package top.yxqz.session.demo.web
 * 重定向2次，请求转发一次请求
 */
@WebServlet("/go")
public class Go extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String contextPath = getServletContext().getContextPath();
//        去登录
        response.sendRedirect(contextPath+"/login");
//        request.getRequestDispatcher("/login").forward(request,response);
    }
}
